//
//  UIView+Extension.swift
//  CWWeibo06
//
//  Created by ycw on 2017/7/22.
//  Copyright © 2017年 xiaowei. All rights reserved.
//

import UIKit


extension UIView{

/*
 1.在分类中无法设置存储属性
 */

//x坐标
    
    var x: CGFloat {
        
        set{
            frame.origin.x = newValue
            
        }get{
            
            return frame.origin.x
        }
    }
    //y坐标
    var y: CGFloat {
        
        set{
            frame.origin.y = newValue
            
        }get{
            
            return frame.origin.y
        }
    }
    
    //width
    var width: CGFloat {
        
        set{
            frame.size.width = newValue
            
        }get{
            
            return frame.size.width
        }
    }
    
    //height
    var height: CGFloat {
        
        set{
            frame.size.height = newValue
            
        }get{
            
            return frame.size.height
        }
    }
    
    //size
    var size: CGSize {
        
        set{
            frame.size = newValue
            
        }get{
            
            return frame.size
        }
    }
    
    //center.x
    var centerX: CGFloat {
        
        set{
            center.x = newValue
            
        }get{
            
            return center.x
        }
    }
    
    //center.y
    var centerY: CGFloat {
        
        set{
            center.y = newValue
            
        }get{
            
            return center.y
        }
    }

}
